rtc: s35390a: improve irq handling
authorUwe Kleine-König <uwe@kleine-koenig.org>
Sat, 2 Jul 2016 15:28:10 +0000 (17:28 +0200)
committerSalvatore Bonaccorso <carnil@debian.org>
Wed, 19 Oct 2016 15:56:57 +0000 (15:56 +0000)
commitb181f425bbfdfc94198a82494e2db2426d7e3d11
treed82931f440ccfc8f068db21f0ce8fd3b62431f9e
parent8025e0446fad39fe1c4208c1c016a1ab9672a141
rtc: s35390a: improve irq handling

On some QNAP NAS devices the rtc can wake the machine. Several people
noticed that once the machine was woken this way it fails to shut down.
That's because the driver fails to acknowledge the interrupt and so it
keeps active and restarts the machine immediatly after shutdown. See
https://bugs.debian.org/794266 for a bug report.

Doing this correctly requires to interpret the INT2 flag of the first read
of the STATUS1 register because this bit is cleared by read.

Note this is not maximally robust though because a pending irq isn't
detected when the STATUS1 register was already read (and so INT2 is not
set) but the irq was not disabled. But that is a hardware imposed problem
that cannot easily be fixed by software.

Signed-off-by: Uwe Kleine-König <uwe@kleine-koenig.org>
Signed-off-by: Alexandre Belloni <alexandre.belloni@free-electrons.com>
Gbp-Pq: Topic bugfix/all
Gbp-Pq: Name rtc-s35390a-improve-irq-handling.patch
drivers/rtc/rtc-s35390a.c